﻿@model List<Student>
@{ 
    ViewData["Title"] = "查询学生信息";
}

<h1>@ViewData["Title"]</h1>

<form asp-action="SelectStudent" method="post" style="width:200px;margin:20px auto">
    <input type="text" name="queryStr" value="" />
    <button type="submit" class="btn btn-primary">查询</button>
</form>
<div class="card-body">
    <table class="table">
        <thead class="table-active">
            <tr>
                <th><span>学号</span></th>
                <th><span>姓名</span></th>
                <th><span>性别</span></th>
                <th style="display:block;" class="text-center"><span>操作</span></th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>@item.SNo</td>
                    <td>@item.Name</td>
                    <td>@item.Gender</td>
                    <td style="display:block;width:300px;margin:0 auto;" class="text-center">
                        <a class="btn btn-primary" asp-action="GetStudent" asp-controller="home" asp-route-Id="@item.Id">详细</a>
                        <a class="btn btn-primary" asp-action="UpdateStudent" asp-controller="home" asp-route-Id="@item.Id">修改</a>
                        <form asp-action="DeleteStudent" asp-route-Id="@item.Id" method="post" style="display:inline">
                            <button class="btn btn-danger" type="submit" onclick="return confirm('确认要删除吗？')">
                                删除
                            </button>
                        </form>
                    </td>
                </tr>
            }

        </tbody>
    </table>
</div>
